package javaBase.nowcoder.HJ23_A_删除字符串中出现次数最少的字符;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        TreeMap<Character, Integer> treeMap = new TreeMap<>();
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            treeMap.put(c, treeMap.getOrDefault(c, 0) + 1);

        }
        List<Map.Entry<Character, Integer>> collect = treeMap.entrySet().stream().sorted((o1, o2) -> {
            return o1.getValue() - o2.getValue();
        }).collect(Collectors.toList());
        String s = str.replaceAll(String.valueOf(collect.get(0).getKey()), "");
        for (int i = 1; i < collect.size(); i++) {
            if (collect.get(i).getValue().equals(collect.get(0).getValue())) {
                s = s.replaceAll(String.valueOf(collect.get(i).getKey()), "");
            }
        }
        System.out.println(s);
    }
}

